package com.swust.test01;
import java.util.concurrent.TimeUnit;
import java.util.Date;
import java.io.File;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.*;
import static org.openqa.selenium.OutputType.*;

public class test {
    public static void main(String[] args) throws Exception {
        FirefoxDriver wd;
        System.setProperty("webdriver.firefox.bin", "E:\\firefox\\firefox.exe");
        System.setProperty("webdriver.gecko.driver", "F:\\geckodriver\\geckodriver.exe");
        wd = new FirefoxDriver();
        wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
        wd.get("http://cn.onlinebmicalculator.com/");
        wd.findElement(By.name("f_height")).click();
        wd.findElement(By.name("f_height")).clear();
        wd.findElement(By.name("f_height")).sendKeys("250");
        wd.findElement(By.name("f_weight")).click();
        wd.findElement(By.name("f_weight")).clear();
        wd.findElement(By.name("f_weight")).sendKeys("100");
        wd.findElement(By.name("f_submit")).click();
        wd.quit();
    }
    
    public static boolean isAlertPresent(FirefoxDriver wd) {
        try {
            wd.switchTo().alert();
            return true;
        } catch (NoAlertPresentException e) {
            return false;
        }
    }
}
